<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="decorator" uri="http://claudiushauptmann.com/jsp-decorator/"%>
<%@ page import="vn.fpt.fsoft.entity.User" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<!-- Decorator title -->
<title><decorator:placeholder name="title"></decorator:placeholder></title>
<link rel="stylesheet" href="css/style-homepage.css" type="text/css">
<script
	src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<script
	src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js">
</script>

<!-- Decorator head -->
<decorator:placeholder name="head"/>

<script>
	function logout(){
		$.ajax({
			url: "UserController?action=logout",
			type: "POST",
			success:function(data){
			},
			error:function(data){
			}
		});
		return true;	
	}
</script>
</head>

<body>
	<%
		User user = (User) request.getSession().getAttribute("user");
		if(user == null) {
		    response.sendRedirect("login.jsp");
		}
	%>
  <table align="center" border="0" cellpadding="0" cellspacing="0" width="865">
    <tr>
      <td id="oben" valign="top" height="156"><div class="headertextoben"><p> Hello 
	      <%= 
	      	(user!=null) ? user.getUsername() : "" 
	      %>
	      , | <a href="login.jsp" onclick="return logout();">Logout</a></div>
	      <div class="headertextgross">Geography Management System</div>
	      <div class="headertextklein">Global Software Talent - Team: J3.1</div>
      </td>
    </tr>
    <tr>
      <td id="navi" width="865"><div class="headernavi">
      <a href="index.jsp">Home</a>
      <a href="ListTrustRegion.jsp">Trust Region/Trust District</a>
      <a href="ListGovOfficeRegion.jsp">Government</a>
      
      <%= 
      	(user!=null && user.getRole() == 1) ? "<a href=\"ListUser.jsp\">User</a>" : "" 
      %>
      </div></td>
    </tr>
    <tr>
      <td id="mainbg" valign="top"><div id="haupttext">
        <!--Main Text starts-->

		<decorator:placeholder name="body"/>
        
        <!--End of Text-->
        </div></td>
    </tr>
    <tr>
      <td id="unten" height="74"><p style="margin-top: -20px;">FSOFT - GLOBAL SOFTWARE TALENT</p></td>
    </tr>
</table>
</body>
</html>